import socket

client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client.connect(('127.0.0.1', 8001))

data = client.recv(1024)
print(data.decode('utf8'))

while True:
    question = input('请输入问题：（Q/q退出）')
    if question == 'Q' or question == 'q':
        break
    client.sendall(question.encode('utf8'))
    reply = client.recv(1024)
    print('这是回复的内容：', reply.decode('utf8'))
client.close()
